<?php
require('../includes/class.main.php');
require('../includes/admin.functions.php');
$manager = new MeetingManager();

// include admin header
include('../template/admin-header.php');


// process form data
if (isset($_SESSION['exportStatus']) && $_SESSION['exportStatus'] != '') {
	$status = $_SESSION['exportStatus'];
	$_SESSION['exportStatus'] = '';
}

?>
<div class="left">
<?php 
include('../admin/menu.php');
?>
</div>

<div class="right">
	<h1>
		<span class="blue">Export Calendar Data</span>
	</h1>
	<br>
	
	<form enctype="multipart/form-data" action="backup-calendar.php"
		method="POST">
			<input
			type="submit" name="submit" formaction="backup-calendar.php" value="Create New Export" />
	</form>
	<?
	if (isset($status)) {
		echo "<br><hr><pre>$status</pre><hr>\n";
	}
	?>
	<br> <b>Select Export To Download</b><br>	
	
	<?
	$files = sortedDirectoryList('../xlsdata/', '/^calendar_export-.*\.xls$/');

	for ($i = 0; $i < count($files); ++$i) {
		echo '<a href="../xlsdata/' . $files[$i]["name"] . '">' . date("M d, Y h:i:s T", $files[$i]["ctime"]) . " </a><br>";
	}
	
	?>
	<br/>
	<br/>
</div>
<?  include('../template/admin-footer.php'); ?>
